package com.bwie.es.init;

import com.bwie.common.domain.response.ShopResponse;
import com.bwie.common.result.Result;
import com.bwie.es.domain.EsShop;
import com.bwie.es.remote.ShopRemote;
import com.bwie.es.service.EsService;
import org.dromara.easyes.core.biz.EsPageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.util.List;

/**
 * Es店铺开机自启
 *
 * @author <a href="mailto:2891704036@qq.com">zhiyuheng</a>
 * @version 1.0
 * @description: Es店铺开机自启
 * @date 2025/9/9 10:49
 */
@Component
public class EsShopInit {

    @Autowired
    private ShopRemote shopRemote;
    @Autowired
    private EsService esService;

    @PostConstruct
    public void shopList(){
        Result<List<ShopResponse>> listResult = shopRemote.shopList(null);
        List<ShopResponse> list = listResult.getData();
        esService.add((EsShop) list);
    }
}
